const seq = require('sequelize')
const time = require('../time')

module.exports = {
  NAME: 'data_source',
  TABLE: {
    data_source_id: {
      type: seq.INTEGER(11),
      primaryKey: true,
      unique: true,
      autoIncrement: true,
      comment: 'data_source_id 主键，自增',
      field: 'data_source_id' //  相应的字段名称
    },
    name: {
      type: seq.STRING(64),
      comment: '数据源名称',
      field: 'name'
    },
    db_type: {
      type: seq.STRING(15),
      comment: '数据源类型(pgsql mysql csv,oracle)',
      field: 'db_type'
    },
    host: {
      type: seq.STRING(31),
      comment: '主机地址或IP地址',
      field: 'host'
    },
    port: {
      type: seq.INTEGER(4),
      comment: '端口号',
      field: 'port'
    },
    db_name: {
      type: seq.STRING(31),
      comment: '数据库名称',
      field: 'db_name'
    },
    user: {
      type: seq.STRING(31),
      comment: '数据库用户名',
      field: 'user'
    },
    password: {
      type: seq.STRING(255),
      comment: '数据库密码',
      field: 'password'
    },
    remark: {
      type: seq.TEXT,
      comment: '备注',
      field: 'remark',
    },
    ...time.create_date,
    ...time.update_date,
    ...time.delete_date,
    ...time.create_by,
    ...time.update_by,
    ...time.delete_by
  }
}
